<?php
$error = false;
if($this->Session->check('process_error')){
    if($this->Session->read('process_error') == 'yes'){
        $error = true;
    }
    $controller->Session->delete('process_error');
}
?>
<?php
$flash_msg = $this->Session->read('Message');
if(isset($flash_msg['flash'])){
    ?>
    <div class="row-fluid">
        <div class="span12">
            <?php
            if($error){
                echo $this->Message->msg('Status',$this->Session->flash(),'error',true);
            }
            else{
                echo $this->Message->msg('Status',$this->Session->flash(),'success',true);
            }
            ?>
        </div>
    </div>
<?php
}
?>
<div class="row-fluid">

    <div class="span12">
        <?php echo $this->Form->create('Config', array('id' => 'form','class'=>'editprofileform'));?>

        <div class="widgetbox personal-information">
            <h4 class="widgettitle">Configurations</h4>
            <div class="widgetcontent">
                <?php foreach($configs as $cfg) {
                    $id = $cfg['Config']['id'];
                    $name = $cfg['Config']['description'];
                    $value = $cfg['Config']['value'];
                    ?>
                    <p style="border-top:1px dashed #333; ">
                        <label style="width: inherit; margin: 19px;"><?php echo $name; ?>:</label>
                        <?php
                        echo $this->Form->input("Config.$id.value", array('type'=>'text', 'label' => false, 'class' => 'input-xlarge','value'=>"$value"));
                        echo $this->Form->input("Config.$id.id", array('label' => false, 'value'=>"$id"));
                        ?>
                    </p>
                <?php } ?>
            </div>
        </div>

        <p>
            <?php
            if(in_array('E',$permissions)){
            ?>
                <button type="submit" class="btn btn-primary">Save Configuration</button> &nbsp;
            <?php
            }
            ?>
        </p>

        <?php echo $this->Form->end();?>
    </div><!--span8-->
</div><!--row-fluid-->

<!-- URLs -->
<input type="hidden" id="company_save_url" value="<?php echo $this->Html->url(array('controller' => 'Admin', 'action' => 'config')); ?>" />

<!-- Le Script -->
<?php
    //echo $this->Html->script('scripts/admin/company.js');
?>
